<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div></div>
    <script>
        function show(){
            var today=new Date();
            var year=today.getFullYear();
            var month=today.getMonth();
            var date=today.getDate();
            var hours=today.getHours();
            var miniutes=today.getMinutes();
            var seconds=today.getSeconds();
            var day=today.getDay();//[0-6]
            var arrs=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
            var noon="AM";
            if(hours>12){
                noon="PM";
                hours=hours-12;
            }
            if(miniutes<10){
                miniutes="0"+miniutes;
            }
            if(seconds<10){
                seconds="0"+seconds;
            }
            var div=document.querySelector("div");
            div.innerHTML=year+"年"+(month+1)+"月"+date+"日"+"&nbsp;&nbsp;"+hours+":"+miniutes+":"+seconds+"&nbsp;&nbsp;"+arrs[day]+" "+noon;

        }
        show();
        setInterval(show,1000);
    </script>
</body>
</html>